package edu.nju.desserthouse.action.business;

import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;

import nju.edu.desserthouse.model.Sale;

public class SaleInfoBean implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private int totalSale;
	private double totalIncome;
	private long shopNum;
	
	private ArrayList<Sale> saleList = new ArrayList<Sale>();
	private ArrayList<Integer> saleNum = new ArrayList<Integer>();
	private ArrayList<Double> saleIncome = new ArrayList<Double>();
	private ArrayList<Double> numRatio = new ArrayList<Double>();
	private ArrayList<Double> incomeRatio = new ArrayList<Double>();
	
	public int getSaleSize(){
		return saleList.size();
	}
	
	public int getListSize(){
		return saleNum.size();
	}
	
	public int getSaleNum(int i){
		return saleNum.get(i);
	}
	
	public int getSaleShop(int i){
		return saleList.get(i).getShop();
	}
	
	public double getSalePrice(int i){
		return saleList.get(i).getPrice();
	}
	
	public double getSaleIncome(int i){
		return saleIncome.get(i);
	}
	
	public double getNumRatio(int i){
		return numRatio.get(i);
	}
	
	public double getIncomeRatio(int i){
		return incomeRatio.get(i);
	}
	
	public void initSaleInfoList(long shopNum){
		for(int i = 0; i < shopNum; i ++){
			saleNum.add(i, 0);
			saleIncome.add(i, 0.0);
			numRatio.add(i,0.0);
			incomeRatio.add(i, 0.0);
		}
	}
	
	public void addToSaleNum(int index){
		int value = saleNum.get(index);
		value++;
		saleNum.set(index, value);
	}
	
	public void addToSaleIncome(int index, double value){
		double income = saleIncome.get(index);
		income += value;
		saleIncome.set(index, income);
	}
	
	public void setNumRatio(int index, double ratio){
		numRatio.set(index, ratio);
	}
	
	public void setIncomeRatio(int index, double ratio){
		incomeRatio.set(index, ratio);
	}
	
	public void setSaleList(ArrayList<Sale> saleList){
		this.saleList = saleList;
	}

	public double getTotalIncome() {
		return totalIncome;
	}

	public void setTotalIncome(double totalIncome) {
		this.totalIncome = totalIncome;
	}

	public int getTotalSale() {
		return totalSale;
	}

	public void setTotalSale(int totalSale) {
		this.totalSale = totalSale;
	}

	public long getShopNum() {
		return shopNum;
	}

	public void setShopNum(long shopNum) {
		this.shopNum = shopNum;
	}
	
	public long getSaleId(int i){
		return saleList.get(i).getId();
	}
	
	public long getSaleVip(int i){
		return saleList.get(i).getVip();
	}
	
	public int getSaleGoods(int i){
		return saleList.get(i).getGoods();
	}
	
	public Date getSaleDate(int i){
		return saleList.get(i).getDate();
	}
	
	public double getPrice(int i){
		return saleList.get(i).getPrice();
	}
	
	public int getShop(int i){
		return saleList.get(i).getShop();
	}
	
	public int getSaleNum(){
		return saleList.size();
	}
}
